home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / c / c-tools-.000 / c-tools- / c-tools-0.4 / examples / tst / obscure.normal < prev    next >
Encoding:
Text File  |  1995-08-13  |  829 b   |  46 lines

  1. /* output of `obscure stripcr.c obscure.normal' */
  2.  
  3.  
  4. #include <string.h>
  5. #include <stdio.h>
  6.  
  7. #include <ctype.h>
  8. #include <assert.h>
  9.  
  10. int main(int q0, char **q1)
  11. {
  12.     FILE *q2 = stdin, *q3 = stdout;
  13.     int q4;
  14.  
  15.     if (q0 > 1) {
  16.     if (!strcmp(q1[1], "-h") || q0 > 3) {
  17.         fprintf(stderr, "\
  18. %s: remove carriage returns from input file\n\
  19. usage: %s [input] [[output]]\n", q1[0], q1[0]);
  20.         exit(0);
  21.     } else {
  22.         if (strcmp(q1[1], "-") != 0 &&
  23.         (q2 = fopen(q1[1], "rb")) == NULL) {
  24.         fprintf(stderr, "%s: no such file\n", q1[1]);
  25.         exit(1);
  26.         }
  27.     }
  28.     if (q0 == 3) {
  29.         if ((q3 = fopen(q1[2], "wb")) == NULL) {
  30.         fprintf(stderr, "%s: cannot open output file\n", q1[2]);
  31.         exit(1);
  32.         }
  33.     }
  34.     }
  35.     while ((q4 = fgetc(q2)) != EOF)
  36.     if (q4 != 0x0d)
  37.         fputc(q4, q3);
  38.  
  39.     fclose(q2);
  40.     fclose(q3);
  41.  
  42.     return 0;
  43. }
  44.  
  45.  
  46.